home *** CD-ROM | disk | FTP | other *** search
- Path: news.th-darmstadt.de!news!enno
- From: enno@inferenzsysteme.informatik.th-darmstadt.de (Enno Sandner)
- Newsgroups: comp.lang.c++
- Subject: Re: How do I overload 'char*' in my class. Is it possible?
- Date: 13 Feb 1996 18:57:56 GMT
- Organization: Fachbereich Informatik, TH Darmstadt
- Distribution: world
- Message-ID: <ENNO.96Feb13195757@kitz.inferenzsysteme.informatik.th-darmstadt.de>
- References: <4fp80t$odj@alcor.usc.edu>
- NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
- In-reply-to: wawda@alcor.usc.edu's message of 12 Feb 1996 21:36:29 -0800
-
- In article <4fp80t$odj@alcor.usc.edu> wawda@alcor.usc.edu (Abu Wawda) writes:
-
- I wrote a string class and now I would like to overload: char*
- (character pointer), but can't figure out how to do it. I've already
- overloaded the +, +=, ==, =, and some operator operators, but can't
- figure how to do this (or even if it's possible). Basically I want
- something like:
-
- char* operator ?? ()
-
- so that my string class can also return char*. Please help. Thanks,
-
- You may define a conversion operator:
-
- operator const char* () const { return string_as_char_array; }
-
-
- Enno
-